package com.y.simple.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import com.y.simple.entity.UserMain;
import com.y.simple.vo.UserMainVo;
import java.util.List;
import java.util.ArrayList;
import io.swagger.v3.oas.annotations.media.Schema;

import lombok.Data;

/**
* <p>
* 
* </p>
*
* @author y2014188432
* @since 2023-05-23
*/
@Data
@TableName("user_main")
@Schema(name = "UserMainVo", description = "")
    public class UserMainVo implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(name = "id", description = "id")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @Schema(name = "userName", description = "用户名")
    private String userName;

    @Schema(name = "userPhone", description = "用户手机号")
    private String userPhone;

    @Schema(name = "userEmail", description = "用户邮箱")
    private String userEmail;

    @Schema(name = "userPassword", description = "用户密码")
    private String userPassword;

    @Schema(name = "userType", description = "身份")
    private String userType;

    @Schema(name = "userState", description = "用户状态")
    private String userState;

    @Schema(name = "createTime", description = "创建时间")
    private LocalDateTime createTime;

    @Schema(name = "isDelete", description = "删除标记 0 未删除 1 删除")
    private String isDelete;



    /**
    * 将 entity 对象转换为 vo
    * @return vo
    */
    public static UserMainVo parseEntity(UserMain entity) {
        UserMainVo vo = new UserMainVo();
        vo.setId( entity.getId() );
        vo.setUserName( entity.getUserName() );
        vo.setUserPhone( entity.getUserPhone() );
        vo.setUserEmail( entity.getUserEmail() );
        vo.setUserPassword( entity.getUserPassword() );
        vo.setUserType( entity.getUserType() );
        vo.setUserState( entity.getUserState() );
        vo.setCreateTime( entity.getCreateTime() );
        vo.setIsDelete( entity.getIsDelete() );
        return vo;
    }

    /**
    * 将 entityList 对象转换为 voList
    * @return voList
    */
    public static List< UserMainVo > parseEntityList(List<UserMain> entityList) {
        List< UserMainVo > list = new ArrayList<>();
        for (UserMain entity : entityList) {
            list.add(UserMainVo.parseEntity(entity));
        }
        return list;
    }


}
